package cn.itcast.mp.pojo;

import cn.itcast.mp.enums.SexEnum;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("tb_user")
public class User extends Model<User> {
    @TableId(type = IdType.AUTO)//指定id类型为自增长
    private Long id;
    private String userName;
    @TableField(fill = FieldFill.INSERT)//在插入数据时，进行该字段的数据填充
    private String password;
    private String name;
    private Integer age;
    @TableField(value = "email") //解决属性名和字段名不一致
    private String mail;

    @TableField(exist = false) //该字段在数据表中不存在
    private String address;

    @Version //MP 乐观锁插件
    private Integer version;

    @TableLogic //标记逻辑删除字段
    private Integer deleted;

    private SexEnum sex; //枚举类型
}
